/*
 * Copyright (C) 2013 Daniel Treffenstädt <daniel@treffenstaedt.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#ifndef O_VECTOR2D_H
#define O_VECTOR2D_H

#include "../OGlobal.h"

O_START_NAMESPACE

/**
 * @brief The Vector2D class
 */
class O_EXPORT Vector2D
{
private:
	/**
	 * @brief contains the x component
	 */
	double			m_x;
	/**
	 * @brief contains the y component
	 */
	double			m_y;
	/**
	 * @brief contains if the vector is valid
	 */
	bool			m_valid;

public:
	/**
	 * @brief Constructs an invalid Vector2D object
	 */
	Vector2D();
	/**
	 * @brief Constructs a valid vector2D object
	 * @param x component
	 * @param y component
	 */
	Vector2D(double x, double y);

	/**
	 * @brief valid
	 * @return
	 */
	bool valid();

	/**
	 * @brief x
	 * @return
	 */
	double x();
	/**
	 * @brief y
	 * @return
	 */
	double y();

	/**
	 * @brief magnitude
	 * @return
	 */
	double magnitude();

	/**
	 * @brief operator +=
	 * @param v
	 */
	void operator+= (Vector2D v);
	/**
	 * @brief operator +
	 * @param v
	 * @return
	 */
	Vector2D operator+ (Vector2D v);

	/**
	 * @brief operator -=
	 * @param v
	 */
	void operator-= (Vector2D v);
	/**
	 * @brief operator -
	 * @param v
	 * @return
	 */
	Vector2D operator- (Vector2D v);

	/**
	 * @brief operator <
	 * @param v
	 * @return
	 */
	bool operator< (Vector2D v);
	/**
	 * @brief operator <=
	 * @param v
	 * @return
	 */
	bool operator<= (Vector2D v);

	/**
	 * @brief operator >
	 * @param v
	 * @return
	 */
	bool operator> (Vector2D v);
	/**
	 * @brief operator >=
	 * @param v
	 * @return
	 */
	bool operator>= (Vector2D v);

	/**
	 * @brief operator ==
	 * @param v
	 * @return
	 */
	bool operator== (Vector2D v);
	/**
	 * @brief operator !=
	 * @param v
	 * @return
	 */
	bool operator!= (Vector2D v);

	/**
	 * @brief operator *=
	 * @param a
	 */
	void operator*= (double a);
	/**
	 * @brief operator *
	 * @param a
	 * @return
	 */
	Vector2D operator* (double a);

	/**
	 * @brief operator /=
	 * @param a
	 */
	void operator/= (double a);
	/**
	 * @brief operator /
	 * @param a
	 * @return
	 */
	Vector2D operator/ (double a);
};

O_END_NAMESPACE

#endif // O_VECTOR2D_H
